package com.trz.cqrs.es.event.priority;

import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
public enum Priority {

    P1("每5秒", 5),//重试一次
    P2("每10秒", 10),
    P3("每15秒", 15),
    P4("每30秒", 30),
    P5("每1分", 60),
    P6("每5分", 300),
    P7("每10分", 600),
    P8("每15分", 900),
    P9("每30分", 1800),//

//    HIGH(P1),
//    MEDIUM(P5),
//    LOW(P9)
    ;

    @Getter
    private final String value;

    @Getter
    private final int retryInterval;

    Priority(Priority priority) {
        this(priority.value, priority.retryInterval);
    }

    @Override
    public String toString() {
        return value;
    }

    public static void main(String[] args) {
        for (Priority p:Priority.values()) {
            System.out.println(p.getValue());
        }
        System.out.println(Priority.values()[Priority.P1.ordinal()+1]);
        System.out.println(Priority.values().length);

    }
}
